package lojaVirtual.manterCadastro.dao;

import java.util.List;

 
import lojaVirtual.manterCadastro.pojo.TipoUsuario;

public class TipoUsuarioDao implements IDao<TipoUsuario> {

	private final GenericDao<TipoUsuario> dao;
	
	public TipoUsuarioDao() {
		
		dao = new GenericDao<TipoUsuario>(TipoUsuario.class);
	}

	@Override
	public void save(TipoUsuario e) {
		this.dao.save(e);
		
	}

	@Override
	public void delete(TipoUsuario e) {
		this.dao.delete(e);
		
	}

	@Override
	public TipoUsuario find(Integer id) {
		 
		return this.dao.find(id);
	}

	@Override
	public List<TipoUsuario> list() {
 		return this.dao.list("tip_descricao");
	}
	
	public List<TipoUsuario> listByWhere(List<String> columns, List<String> values,
			String ordem) {

		String where = "";
		int count = 0;
		for (String column : columns) {

			if (count > 0)
				where += " and ";
			where += " " + column + "=" + values.get(count);
			count++;

		}
		where += " ";

		return this.dao.list(ordem, where);
	}

	@Override
	public List<TipoUsuario> listByStatus() {
		return this.dao.list("tip_descricao");
	}

	
}
